﻿Public Interface XCLIPlugin
    ReadOnly Property CommonName As String
    ReadOnly Property Fullname As String
    ReadOnly Property Description As String
    ReadOnly Property Author As String
    ReadOnly Property Dependencies As String
    ReadOnly Property Build As String
    ReadOnly Property Keywords As String

    Sub CONSTRUCT(ByVal command As String, ByRef env() As String)
    Sub HELP(ByVal command As String, ByRef env() As String)

End Interface

Namespace ErrorHandling
    Class Log
        'create a new log file
        '''<summary>
        '''<para>Creates a log file for use in your plugin.</para>
        '''<param name="Name">The log name (extension not required)</param>
        '''<param name="env()">The environmental variable from XCLI</param>
        '''<returns>True if log file has been created, else False.</returns>
        '''</summary>
        Public Shared Function create(ByVal Name As String, ByRef env() As String) As Boolean
            Try
                'check it has a valid extension
                If Not Name.EndsWith(".log") Or Name.EndsWith(".txt") Then
                    Name = Name & ".log"
                End If

                'env(2) is the logfile location
                Dim path As String = env(2) & name
                'create it
                System.IO.File.Create(path)
                Return True
            Catch ex As Exception
                Return False
            End Try
        End Function
    End Class
End Namespace